package com.nbcb.dao;

import com.nbcb.domain.Order;

import java.util.*;

public class OrderDao {

    public void save(Order order) {
        Constant.orderHashMap.put(order.getId(), order);
    }

    public List<Order> selctAll() {
        List<Order> orderList = new ArrayList<>();
        HashMap<String, Order> orderHashMap = Constant.orderHashMap;
        for (Map.Entry entry:orderHashMap.entrySet()) {
            orderList.add((Order) entry.getValue());
        }

//        Set<String> strings = orderHashMap.keySet();
//        for (String s: strings
//             ) {
//            Order order = orderHashMap.get(s);
//            orderList.add(order);
//        }


        return orderList;
    }
}
